package com.zttek.photosShareProject.common.json;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zttek.photosShareProject.modules.model.Comment;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Y
 * Date: 2017-08-28
 * Time: 15:36
 */
public class CommentVO implements VO {

    private Long commentId;
    private Long shareId;
    private UserVO owner;
    private String content;
    private Integer totalPrasie;
    private boolean reply;
    private UserVO replyUser;
    private String replyContent;
    private UserVO[] atUsers;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    private boolean hasPraise;

    public CommentVO() {
    }

    public CommentVO(Comment comment, UserVO ownerVO, UserVO replyUser, String replyContent, boolean praise, UserVO[] atUsers) {
        commentId = comment.getId();
        shareId = comment.getShareId();
        owner = ownerVO;
        content = comment.getContent();
        totalPrasie = comment.getTotalPraise();
        reply = replyUser != null;
        this.replyUser = replyUser;
        this.replyContent = replyContent;
        this.atUsers = atUsers;
        createTime = comment.getCreateTime();
        hasPraise = praise;
    }

    public Long getCommentId() {
        return commentId;
    }

    public void setCommentId(Long commentId) {
        this.commentId = commentId;
    }

    public Long getShareId() {
        return shareId;
    }

    public void setShareId(Long shareId) {
        this.shareId = shareId;
    }

    public UserVO getOwner() {
        return owner;
    }

    public void setOwner(UserVO owner) {
        this.owner = owner;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getTotalPrasie() {
        return totalPrasie;
    }

    public void setTotalPrasie(Integer totalPrasie) {
        this.totalPrasie = totalPrasie;
    }

    public boolean isReply() {
        return reply;
    }

    public void setReply(boolean reply) {
        this.reply = reply;
    }

    public UserVO getReplyUser() {
        return replyUser;
    }

    public void setReplyUser(UserVO replyUser) {
        this.replyUser = replyUser;
    }

    public String getReplyContent() {
        return replyContent;
    }

    public void setReplyContent(String replyContent) {
        this.replyContent = replyContent;
    }

    public UserVO[] getAtUsers() {
        return atUsers;
    }

    public void setAtUsers(UserVO[] atUsers) {
        this.atUsers = atUsers;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public boolean isHasPraise() {
        return hasPraise;
    }

    public void setHasPraise(boolean hasPraise) {
        this.hasPraise = hasPraise;
    }

    public static class GetListForm{

        private Integer pageNum;
        private Integer pageSize;
        private String orderByField;
        private Long shareId;
        private Long userId;
        private boolean ascend;

        public Integer getPageNum() {
            return pageNum;
        }

        public void setPageNum(Integer pageNum) {
            this.pageNum = pageNum;
        }

        public Integer getPageSize() {
            return pageSize;
        }

        public void setPageSize(Integer pageSize) {
            this.pageSize = pageSize;
        }

        public String getOrderByField() {
            return orderByField;
        }

        public void setOrderByField(String orderByField) {
            this.orderByField = orderByField;
        }

        public Long getShareId() {
            return shareId;
        }

        public void setShareId(Long shareId) {
            this.shareId = shareId;
        }

        public Long getUserId() {
            return userId;
        }

        public void setUserId(Long userId) {
            this.userId = userId;
        }

        public boolean isAscend() {
            return ascend;
        }

        public void setAscend(boolean ascend) {
            this.ascend = ascend;
        }
    }

    public static class RelevanceForm {

        private Long commentId;
        private Long userId;
        private boolean direction;

        public Long getCommentId() {
            return commentId;
        }

        public void setCommentId(Long commentId) {
            this.commentId = commentId;
        }

        public Long getUserId() {
            return userId;
        }

        public void setUserId(Long userId) {
            this.userId = userId;
        }

        public boolean isDirection() {
            return direction;
        }

        public void setDirection(boolean direction) {
            this.direction = direction;
        }
    }

    public static class createForm{

        private String content;
        private Long[] atIds;
        private Long shareId;;
        private Long userId;
        private Long targetId;

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public Long[] getAtIds() {
            return atIds;
        }

        public void setAtIds(Long[] atIds) {
            this.atIds = atIds;
        }

        public Long getShareId() {
            return shareId;
        }

        public void setShareId(Long shareId) {
            this.shareId = shareId;
        }

        public Long getUserId() {
            return userId;
        }

        public void setUserId(Long userId) {
            this.userId = userId;
        }

        public Long getTargetId() {
            return targetId;
        }

        public void setTargetId(Long targetId) {
            this.targetId = targetId;
        }
    }
}
